







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static IEnumerable<T> Replace<T>( IEnumerable<T> collection, Predicate<T> predicate, T replaceWith ) |
Visual Basic (Declaration) |
---|
Public Shared Function Replace(Of T) ( _ collection As IEnumerable(Of T), _ predicate As Predicate(Of T), _ replaceWith As T _ ) As IEnumerable(Of T) |
Visual C++ |
---|
public: generic<typename T> static IEnumerable<T>^ Replace ( IEnumerable<T>^ collection, Predicate<T>^ predicate, T replaceWith ) |
Parameters
- collection
- IEnumerable<(Of <T>)>
The collection to process.
- predicate
- Predicate<(Of <T>)>
The predicate used to evaluate items with the collection. If the predicate returns true for a particular item, the item is replaces with replaceWith.
- replaceWith
- T
The new value to replace with.
Return Value
An new collection with the items from collection, in the same order, with the appropriate replacements made.
Type Parameters
- T
See Also
Algorithms Class
Wintellect.PowerCollections Namespace